package org.joy;

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Base64;

public class BaseUtils {

   static String  readFile(String filepath) throws IOException {
        String context = new String(Files.readAllBytes(Paths.get(filepath)), Charset.forName("UTF-8"));
        return context;
    }

    static String encodeBASE64(String context){
       Base64.Encoder encoder =  Base64.getEncoder();
       return encoder.encodeToString(context.getBytes(Charset.forName("UTF-8")));
    }
}
